/* 
 * 	krawsock : kernel raw socket library API
 * 
 *      Author: SaeedM <saeed.tx@gmail.com> , Aug-2011
 *
 * 
 * 	This program is free software; you can redistribute it and/or
 *      modify it under the terms of the GNU General Public License
 *      as published by the Free Software Foundation; either version
 *      2 of the License, or (at your option) any later version.
 * 
 */

#ifndef _krsock_h_
#define _krsock_h_

#include <linux/net.h>
#include <linux/if_ether.h>
#include <linux/netdevice.h>



struct socket* krsocket_open(char* ifname, int recvbuffsize,int sndbuffsize);

void krsocket_close(struct socket* sk);

ssize_t krecv(struct socket* sk, void *buffer, size_t length, int flags);

ssize_t ksend(struct socket* sk, const void *buffer, size_t length, int flags,int ifindex);

int ksetsockopt(struct socket* sk, int level, int optname, void *optval, int optlen);

int kgetsockopt(struct socket* sk, int level, int optname, void *optval, int *optlen);

unsigned int inet_addr(char* ip);

//char *inet_ntoa(struct in_addr *in); /* DO NOT forget to kfree the return pointer */

#endif /* _krsock_h_ */

